package 笔试.深信服;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress ip = InetAddress.getLocalHost();    //获取本机的InetAddress对象
        System.out.println(Arrays.toString(ip.getAddress()));//返回此 InetAddress对象的原始IP地址。
        System.out.println(ip.getHostAddress());//返回ip地址的字符串
        System.out.println(ip.getHostName());   //返回ip地址的主机名
        System.out.println(InetAddress.getLocalHost());//返回本地主机的地址
    }
}
